package com.ccp.dev.qbdms.service;

import com.ccp.dev.core.basic.base.BaseService;
import com.ccp.dev.core.basic.web.query.QueryFilter;
import com.ccp.dev.core.poi.excel.Excel;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import com.ccp.dev.qbdms.dao.WQbdDailyInspectDao;
import com.ccp.dev.qbdms.model.WQbdDailyInspect;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;


/**
 * 综合质量管理日常检查 信息操作服务类
 *
 * @author rh
 * @date 2020-09-21 10:36:37
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class WQbdDailyInspectService extends BaseService<WQbdDailyInspect> {

    @Resource
    private WQbdDailyInspectDao dao;

    public HSSFWorkbook exportExcel(Excel excel,QueryFilter queryFilter){
    List<WQbdDailyInspect> dataList = this.dao.queryAll(queryFilter);
        int startRow = 1;
        //给每一个单元格赋值
        for (WQbdDailyInspect data : dataList) {
        excel.cell(startRow, 0).value(data.getId());
        //excel.cell(startRow, 1).value(data.getMc());
        //可在赋值时，根据需求进行格式化
        //excel.cell(startRow, 2).value(DateFormatUtil.formatDate(data.getRq()));
        //excel.cell(startRow, 3).value(data.getSj());
        //excel.cell(startRow, 4).value(data.getTenantId());
        startRow++;
        }
        return excel.getWorkBook();
    }

    /**
     * 导出用查询
     *
     * @param queryFilter 查询参数
     * @return list
     */
    public List<WQbdDailyInspect> queryAll(QueryFilter queryFilter) {
        return dao.queryAll(queryFilter);
    }

}
